﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using HelperLib;
using WiimoteLib;

namespace InputControls
{
   public class WiiMoteControl
   {
      private WiimoteEventWrapper WiiMoteEW;
      private readonly Wiimote wm = new Wiimote();

      public WiiMoteControl() {}

      public void connect()
      {
         wm.Connect();
         wm.SetReportType(InputReport.IRAccel, true);
         WiiMoteEW = new WiimoteEventWrapper(wm);
      }

      public void GetKukaCoordinates(ref KukaCoordData coordinate)
      {
         try
         {
            //wii-daten auslesen und irgendwie umrechnen :D

            //dummy
            coordinate.CoordType = KukaCoordType.AxisCoords;
            coordinate.Coordinates.A1 = 0.7f;
         }
         catch (Exception)
         {
            //Wii not connected

            //dummy
            coordinate.CoordType = KukaCoordType.AxisCoords;
            coordinate.Coordinates.A1 = 0.7f;
         }
      }

      public bool HasUI
      {
         get { return false; }
      }

      public UserControl UI
      {
         get { return null; }
      }
   }
}
